const app = new(require('koa'))();
const router = require('koa-Router')();
const cors = require('koa-cors')
const {
    koaBody
} = require('koa-body')

app.use(cors({
    origin: '*'
}))
app.use(koaBody({
    multipart: true
}))

router.post('/car', ctx => {
    ctx.body = {
        code:200,
        data: [{
                value: 600,
                name: "600辆"
            },
            {
                value: 700,
                name: "700辆"
            },
            {
                value: 1000,
                name: "1000辆"
            },
            {
                value: 1100,
                name: "1100辆"
            },
            {
                value: 1200,
                name: "1200辆"
            },
        ]
    }
})
app.use(router);

app.listen(3000, console.log('后端服务启动成功'));